<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>验证用户输入的密码</title>
  <script>
    function fun01() {
      var password = document.getElementById("password").value;
      // prompt('请输入密码：');
      console.log(password);
      // var password = text.innerHTML;
      if (password == '123456') {
        console.log('密码输入正确！');
        //alert('密码输入正确！');
      } else {
        console.log('密码输入错误！');
        //alert('密码输入错误！');
      }
    }

  </script>
</head>

<body>
  <p>请输入：<input type="text" id="password" value="123"></p>
  <p><input type="button" value="提交" onclick="fun01()"></p>
</body>

</html>